﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int count = 0;
	for (int j = 3; j <= n; j++)
	{
		int sum = 0;
		for (int i = 2; i < j; i++)
		{
			if (j % i == 0)
			{
				sum += i;
			}
		}
		if ((sum + 1) == j)
			count++;
	}
	printf("%d", count);
	return 0;
}